package com.cysion.study.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.cysion.study.R
import com.cysion.study.entity.ResearchStuEntity
import com.cysion.study.ktbox.base.BaseAdapter
import com.cysion.study.ktbox.base.BaseViewHolder
import com.cysion.study.ktbox.base.ITEM_CLICK
import kotlinx.android.synthetic.main.item_studies.view.*

class StudiesAdapter(mEntities: MutableList<ResearchStuEntity>, mContext: Context) :
    BaseAdapter<ResearchStuEntity>(mEntities, mContext) {
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): BaseViewHolder<ResearchStuEntity> {

        return ProMoneyHolder(
            LayoutInflater.from(mContext).inflate(R.layout.item_studies, parent, false)
        )
    }

    class ProMoneyHolder(itemView: View) : BaseViewHolder<ResearchStuEntity>(itemView) {
        override fun fillData(obj: ResearchStuEntity, position: Int) {
            itemView?.apply {
                itemView.tv_title.text = obj.name
                itemView.tv_time.text = "日期："+obj.actime

                itemView.setOnClickListener {
                    mOnTypeClickListener?.invoke(obj, position, ITEM_CLICK)
                }

            }

        }

    }

}



